home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
hearts
/
leafpol9.frm
< prev
next >
Wrap
Text File
|
1999-04-16
|
10KB
|
292 lines
VERSION 5.00
Begin VB.Form LeafPol8
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 0 'None
Caption = "Leafpol8 Prg"
ClientHeight = 2400
ClientLeft = 1065
ClientTop = 1515
ClientWidth = 3000
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 2400
ScaleWidth = 3000
ShowInTaskbar = 0 'False
WindowState = 2 'Maximized
End
Attribute VB_Name = "LeafPol8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function ShowCursor& Lib "user32" (ByVal bShow&) 'as Byte
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Sub flower()
pi = 4 * Atn(1)
f1x = stx: f1y = sty 'Take TOP of STEM X,Y
FillColor = QBColor(Int(Rnd * 15) + 1) 'Color of 6 Petals
a = 8 ' Diam of Ring
For s = 3 To 9 Step 3
For t = 0 To pi Step 0.52 '6 Petals
d = a * Cos(t) 'D=Diameter of Ring of Petals
f2x = d * Cos(t): f2y = d * Sin(t)
DrawWidth = 1
Circle (f1x + f2x - 6, f1y + f2y), 9, QBColor(Int(Rnd * 15))
DrawStyle = 2
Circle (f1x + f2x - 6, f1y + f2y), 9
DoEvents
TimeOut
DoEvents
Next t
DoEvents
a = a + 9
Next s
FillStyle = 0 'For next Screen
FillColor = QBColor(Int(Rnd * 15))
Circle (f1x + 8, f1y), 7, QBColor(Int(Rnd * 15))
End Sub
Private Sub leafpol8_KeyPress(KeyAscii As Integer)
ExitClean
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
ExitClean
End Sub
Private Sub Form_Load()
If App.PrevInstance Then
Unload Me
Exit Sub
End If
End Sub
Private Sub heart() '------ THE BIG HEART ------------
FillColor = QBColor(15) ' Clear Big Circle
DrawStyle = 0 'Quick exiting if and when this is made
Circle (0, 0), 138 'into a Screen Saver
WaitABit
pi = 22 / 7
DrawWidth = 3: DrawStyle = 0
a = 100: b = 100 'Q=Theta Angle 'HEART
a1 = 102: b1 = 102
For q = -pi / 2 To 0 Step 0.01 'Polar graph needs Pi iterations.
Y = a * Cos(q * 2) * Sqr(Abs(Sin(q))) 'here we use part of Polar Spiral
X = b * Sin(q * 2) * Sqr(Abs(Cos(q))) 'to make half a heart & mirror img.
Line (0, 0)-(X, Y), QBColor(12)
DoEvents
Line (0, 0)-(-X, Y), QBColor(12)
DoEvents 'for Mouse Move exit
Next q
DoEvents 'Posy Start - On Heart
TimeOut
DrawStyle = 2: DrawWidth = 1: FillStyle = 0
FillColor = QBColor(Int(Rnd * 15) + 1) 'Color of 6 Petals
TimeOut
TimeOut
TimeOut
a = 25 'Diam of Ring of petals.
For t = 0 To pi Step 0.52 ' pi / 6 '6 Petals
d = a * Cos(t)
X = d * Cos(t): Y = d * Sin(t)
Circle (X - 12, Y + 32), 12, QBColor(Int(Rnd * 15))
Next t
DoEvents
DrawStyle = 2
FillColor = QBColor(Int(Rnd * 15))
Circle (X - 25, Y + 32), 7, QBColor(Int(Rnd * 15)) 'Seed Pod?
'----------- End of <Flower-in-Heart>
TimeOut
TimeOut
TimeOut
TimeOut
TimeOut
DoEvents
End Sub
Private Sub leafpol8_Click(Click As Integer)
ExitClean
End Sub
Private Sub ring()
'======== -- Big Ring
ForeColor = QBColor(12)
pi = 4 * Atn(1)
FillStyle = 0
ctr = 0: c = 0
a = 120 'Radius't = -pi
X = a * Cos(t) '\ Set
Y = a * Sin(t) ' >First
PSet (X, Y) '/ Point
' --1st Loop just fills Array. 2nd makes wreath. -------
For t = -pi To pi Step 2 * pi / 32 'Big Pol Circ
ctr = ctr + 1
X = a * Cos(t) 'Convert . .
Y = a * Sin(t) 'to Cartesian
wx(ctr) = X: wy(ctr) = Y 'Fill Wreath Array <wx(),wy()> are SPOTS
Next t ' Spot Centers wx(),wy()
DoEvents
'---------------- Make small hearts here---------------@ spots.
DrawWidth = 3: DrawStyle = 0
a = 15 'Small Hearts
For c = 1 To 32 Step 2
DoEvents
DrawWidth = 2
For q = -pi / 2 To 0 Step 0.05 ' Small Hearts
Y = a * Cos(q * 2) * Sqr(Abs(Sin(q))) 'here we use part of Polar Spiral
X = a * Sin(q * 2) * Sqr(Abs(Cos(q))) 'to make half a heart & mirror img.
Line (wx(c), wy(c))-(X + wx(c), Y + wy(c)) 'Small Heart-Right Half
DoEvents
Line (wx(c), wy(c))-(-X + wx(c), Y + wy(c)) 'Left Half
DoEvents
Next q 'Ring of Small Hearts Done------
TimeOut
c = c + 2 'Next:- Small FLOWER Every other "Spot"-
FillColor = QBColor(Int(Rnd * 15) + 1) 'Color of 6 Petals
a = 15 ' Diam of petal centers
DrawStyle = 2
For t = 0 To pi Step 0.52 '6 Petals
d = a * Cos(t) 'D=
fX = d * Cos(t): fY = d * Sin(t)
DrawWidth = 1
Circle (fX + wx(c) - 6, fY + wy(c)), 7, QBColor(Int(Rnd * 15)) 'Petal
TimeOut
DoEvents
Next t
FillStyle = 0
FillColor = QBColor(Int(Rnd * 15))
Circle (wx(c), wy(c)), 4, QBColor(Int(Rnd * 15)) 'Seed Pod?
TimeOut
Next c
'----------------- Flower every other one.
z = 0: c = 0
DoEvents
Pause
End Sub
' --------- Exit on Mouse Move -----------
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If IsEmpty(mousex) Or IsEmpty(mousey) Or IsNull(mousex) Or IsNull(mousey) Then
mousex = X: mousey = Y
Exit Sub
End If
If Abs(mousex - X) > 2 Or Abs(mousey - Y) > 2 Then
mousex = X: mousey = Y
ExitClean
End If
End Sub
Public Sub ExitClean()
Dim filename As String
Dim rc As Long
bShow& = ShowCursor(True) 'Via API Function(bShow&) call
Unload Me 'See Declares over Form Code
End
End Sub
Public Sub TimeOut()
t = 0
Interval = 0.025
t = Timer + Interval 'Seconds
While Timer < t
Wend
End Sub
Public Sub Pause()
t = 0
t = Timer + 5
While Timer < t
DoEvents
Wend
End Sub
Public Sub WaitABit()
t = 0
t = Timer + 2
While Timer < t
DoEvents
Wend
End Sub
Public Sub begin()
bShow& = ShowCursor(False) 'HIDE Mouse via API Function
Randomize '========================
Dim pi As Single
pi = 4 * Atn(1)
a = 20 'Radius for STEM & LEAVES
X = a * Cos(t) ' \ Set
Y = a * Sin(t) ' >First
PSet (X, Y) '/ Point
Do While DoEvents()
BackColor = QBColor(Int(Rnd * 16))
' --1st Loop Round Polar Circ - For RING around Heart
ctr = 0: a = 20
For t = pi To (-pi) - pi / 3 Step -2 * pi / 30 'Big Pol Circ
ctr = ctr + 1 'Count Points
X = a * Cos(t) 'Convert . .
Y = a * Sin(t) 'to C